package com.heima.wemedia.controller.v1;

import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.SensitiveDto;
import com.heima.wemedia.service.WmSensitiveService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
@RequiredArgsConstructor
public class WmSensitiveController {

    private final WmSensitiveService wmSensitiveService;

    @PostMapping("/list")
    public ResponseResult listSensitiveByPage(@RequestBody SensitiveDto dto){
         return wmSensitiveService.listSensitiveByPage(dto);
    }

    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitiveById(@PathVariable Integer id){
       return wmSensitiveService.deleteSensitiveById(id);
    }

    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody AdSensitive adSensitive){
       return wmSensitiveService.saveSensitive(adSensitive);
    }

    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody AdSensitive adSensitive){
       return wmSensitiveService.updateSensitive(adSensitive);
    }
}
